package pl.edu.agh.neural.core;

import java.util.List;

public class BasicTrainableNetwork extends BasicNetwork implements ITrainableNetwork
{
    List<? extends ITrainableLayer> trainableLayers;

    public BasicTrainableNetwork(InputLayer inputLayer, List<? extends ITrainableLayer> layers)
    {
        super(inputLayer, layers);
        trainableLayers = layers;
    }

    @Override
    public void train(double[][] dataVectors, int steps)
    {
        for (ITrainableLayer trainableLayer : trainableLayers)
        {
            for (int step = 0; step < steps; step++)
            {
                for (double[] dataVector : dataVectors)
                {
                    inputLayer.setValues(dataVector);
                    trainableLayer.train(step);
                }
            }
        }

    }

    @Override
    public void train(double[][] dataVectors, double[][] teachingVectors, int steps)
    {
        train(dataVectors, steps);
    }
}
